import Vue from 'vue';
import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss';
import '@/styles/base.scss';
import '@/styles/tailwind.css';
import App from './App';
import store from './store';
import router from './router';
import '@/icons';
import '@/permission';
import Api from '@/api';
import util from '@/utils/util';
import './utils/directives.js';
import vuepro from '@/utils/vuepro';
import * as Filters from '@/components/filters';

import * as globalComponents from '@/components/globalComponents';
import formRules from '@/utils/formRules';
//复制到粘贴板插件
import VueClipboard from 'vue-clipboard2';

const tinymce = '/tinymce/tinymce.js';
import load from '@/components/Tinymce/dynamicLoadScript';

load(tinymce);

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

Vue.prototype.$ = Api;
Vue.prototype.$util = util;
Vue.prototype.$rule = formRules;
Vue.use(VueClipboard);
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })

Vue.use(ElementUI);
Vue.use(vuepro);
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
//全局过滤器
Object.keys(Filters).forEach((key) => {
  Vue.filter(key, Filters[key]);
});

import initComponent from './initComponent'
initComponent(Vue)
Vue.config.productionTip = false;

new Vue({
  el: '#app',
  router,
  store,
  globalComponents,
  render: (h) => h(App)
});
